﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
    通常把局部视图的名字以 _ 下划线开始
*@
@using Microsoft.AspNetCore.Identity
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager

@if (SignInManager.IsSignedIn(User))
{
    var currentUser = await UserManager.GetUserAsync(User);
    var isAdmin = currentUser != null && await UserManager.IsInRoleAsync(currentUser, Constants.AdministratorRole);

    if (isAdmin)
    {
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link text-dark" asp-controller="ManageUsers" asp-action="Index">Manage users</a>
            </li>
        </ul>
    }
}
